﻿using System.Collections.Generic;

namespace ClassLibrary
{
    /* atomic event */
    public class Event
    {
        public int event_id { set; get; }
        public string event_name { set; get; }

        public Event(int id, string name)
        {
            event_id = id;
            event_name = name;
        }

        public static bool operator ==( Event even1, Event even2)
        {
            return even1.event_id == even2.event_id;
        }

        public static bool operator !=(Event even1, Event even2)
        {
            return even1.event_id != even2.event_id;
        }


        public override bool Equals(object o)
        {
            return this == (Event)o;
        }
        public override int GetHashCode()
        {
            return base.GetHashCode();
        } 
    }


    /* global table of events */
    static public class EventTable
    {
        static public int event_amount { set; get; }
        static public Dictionary<string, Event> str_event_table = new Dictionary<string, Event>();
        static public Dictionary<int, Event> int_event_table = new Dictionary<int, Event>();

        // ! may be do second dictionary with integer keys ???
         
        static EventTable()
        {
            Event some_event;

            event_amount = 2;
            
            // event #0
            some_event = new Event(0, "Having Progency");
            str_event_table.Add(some_event.event_name, some_event);
            int_event_table.Add(some_event.event_id, some_event);

            // event #1
            some_event = new Event(1, "No Having Progency");
            str_event_table.Add(some_event.event_name, some_event);
            int_event_table.Add(some_event.event_id, some_event);
        }

        static public Event getEvent( string event_name)
        {
            return str_event_table[event_name];
        }

        static public Event getEvent( int event_id)
        {
            return int_event_table[event_id];
        }
    }
}